import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'

import App from './App.vue'
import router from './router'
import { useMenuStore } from '@/store/menu';
import { addDynamicRoutes } from '@/router/dynamicRoutes';

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(Antd)

const menuStore = useMenuStore();
if (!menuStore.menuTree) {
  const local = localStorage.getItem('menuTree');
  if (local) {
    menuStore.menuTree = JSON.parse(local);
    addDynamicRoutes(menuStore.menuTree);
  }
}

app.mount('#app')
